/*
 clustering.h
 Matthew Jee
 mcjee@ucsc.edu
*/

#ifndef MJ_CLUSTERING_H
#define MJ_CLUSTERING_H

#include "types.h"

namespace mj {
    
// Path clustering
std::vector<Cluster> clusterPathsSimple(std::vector<Path> &paths, double size);
std::vector<Cluster> clusterPathsDBSCAN(std::vector<Path> &paths,
                                        size_t minPaths,
                                        double epsilon,
                                        double (*distanceFunction)(Path &, Path &));

// Path distance functions
// Use these for large sets of short paths
// quadratic time in the number of paths.
double pathDistance(Path &p, Path &q);
double pathDistanceAlignFront(Path &p, Path &q);
double pathDistanceAlignBack(Path &p, Path &q);

// Use this for small sets of long paths
// It is quadratic space in the number of paths
// quadratic time in number of paths, with a smaller constant
// This maintains a small amount of state which needs
// to be cleared before it is used again
double pathDistanceAlignFrontCached(Path &p, Path &q);
void initPathDistanceCache(std::vector<Path> &paths);
void clearPathDistanceCache(void);

}

#endif
